// import './assets/main.css'

import { createApp } from 'vue'
import { createPinia } from 'pinia'

import Antd from 'ant-design-vue'
import './utils/reset.css'
import { monitorPageLeave } from './utils/monitorLeave.js'

import App from './App.vue'
import { userStore, useLocalStoragePlugin } from './stores/user'
import router from './router'
import { getVisitorId } from '@/utils/utils'
// loading
import LoadingOverlay from 'vue-loading-overlay'
import 'vue-loading-overlay/dist/css/index.css'

import lazyPlugin from 'vue3-lazy'
import errImg from '@/assets/imgs/errorimg.png'
// 获取访客ID
getVisitorId()

const app = createApp(App)
const pinia = createPinia()
// give the plugin to pinia
pinia.use(useLocalStoragePlugin)
app.use(pinia)
app.use(router)
app.use(Antd)
app.use(LoadingOverlay, {
  // 配置选项，如背景颜色、文本、动画等
  backgroundColor: 'rgba(0, 0, 0, 0.7)',
  spinner: 'dots',
  text: 'Loading...',
  textPosition: 'top'
  // 更多配置...
})
app.use(lazyPlugin, {
  error: errImg,
  loading: errImg
})
// app.use(Tabs)
// // app.use(TabPane)
// app.use(Form)
// app.use(Input)
// app.use(Space)
// app.use(InputGroup)

const store = userStore()
store.initUserInfo()

app.mount('#app')
